package com.lenovo.mso2o.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.lenovo.framework.base.ActionBarFragment;
import com.lenovo.framework.base.InjectableFragment;
import com.lenovo.mso2o.R;
import com.umeng.update.UpdateResponse;

import butterknife.Bind;

/**
 * Created by lenovo on 2016/4/28.
 */
public class AboutFragment extends InjectableFragment {
    /*@Bind(R.id.relative_upgrade_about)
    RelativeLayout layoutNewVersion;
    @Bind(R.id.tv_currentVersion_about)
    TextView tvVersion;
    @Bind(R.id.tv_update_find_new_version)
    TextView tvFindNewVersion;
    @Bind(R.id.relative_team_about)
    RelativeLayout layoutTeam;*/

    @Bind(R.id.fragment_about_back)
    RelativeLayout back;
    @Override
    public int provideContentRes() {
        return R.layout.fragment_about;
    }

    @Override
    protected void onFragmentInVisible(Bundle savedInstanceState) {

    }

    @Override
    protected void onFragmentVisible(Bundle savedInstanceState) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
        /*UmengUpdateAgent.setUpdateAutoPopup(false);
        UmengUpdateAgent.setUpdateListener(this);
        UmengUpdateAgent.update(this.getContext());*/
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        back.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
    }

    public void onUpdateReturned(int updateStatus, final UpdateResponse updateResponse) {
        //if (layoutNewVersion == null || updateResponse == null) return;
        /*switch (updateStatus) {
            case UpdateStatus.Yes: // has update
                if (updateResponse.hasUpdate) {
                    this.updateResponse = updateResponse;
                }
                tvFindNewVersion.setVisibility(View.VISIBLE);
                layoutNewVersion.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        String versionCode = getActivity().getResources().getString(R.string.detected_new_version) + updateResponse.version;
                        String packageSize = getActivity().getResources().getString(R.string.update_packget_size) + String.format("%.2f", Double.valueOf(updateResponse.target_size) / 1048576) + "MB";
                        ConfirmDialogFragment updatedialogFragment = ConfirmDialogFragment.newInstance(versionCode, packageSize);
                        updatedialogFragment.setListener(AppSettingFragment.this);
                        updatedialogFragment.show(getFragmentManager(), UPDATE_TAG);
                    }
                });
                break;

        }*/
    }
}
